<template>
	<view class="all">
		<view class="top flex_sp">
			<view class="left">
				门店照
			</view>
			<view class="right flex">
				<!-- <image class="img1" src="../../../static/index/分组 8@2x.png" mode=""></image> -->
				<image class="img1" :src="'https://admin.lykangshu.top'+list.store_photo" mode=""></image>
				<image class="img2" src="../../../static/ming/back.png" mode=""></image>
			</view>
		</view>
		<view class="list">
			<view class="box flex_sp">
				<view class="left">
					昵称
				</view>
				<view class="right flex" @click="showpop()">
					{{list.store_name}}
					<image class="img1" src="../../../static/ming/back.png" mode=""></image>
				</view>
			</view>
			<view class="box flex_sp">
				<view class="left">
					手机号
				</view>
				<view class="right flex">
					{{list.phone}}
					<image class="img1" src="../../../static/ming/back.png" mode=""></image>
				</view>
			</view>
			<view class="box flex_sp">
				<view class="left">
					标签
				</view>
				<view class="right flex" @click="label()">
					已选标签（{{list.personality_label_count}}/{{num}}）
					<image class="img1" src="../../../static/ming/back.png" mode=""></image>
				</view>
			</view>
		</view>
		<u-popup :show="show" mode="center" round="10px">
			<view class="allpop">
				<view class="title">
					昵称
				</view>
				<view class="body">
					<input type="text" placeholder="请输入昵称" v-model="name" />
				</view>
				<view class="last">
					<view class="left" @click="concel()">
						取消
					</view>
					<view class="right" @click="frim()">
						确定
					</view>
				</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: {},
				num: "",
				show: false,
				name: ""
			};
		},
		onShow() {
			this.getmine()
		},
		methods: {
			frim() {
				this.$api('/business/user/profile', 'post', {
					store_name: this.name,
					personality_label: '',
					avatar: "",
					life_photos: ""
				}).then((res) => {
					console.log(res);
					if (res.data.code == 1) {
						uni.$u.toast('修改成功')
						this.show = false
						this.getmine()
					}

				})
			},
			concel() {
				this.show = false
			},
			showpop() {
				this.show = true
			},
			async getmine() {
				const res = this.$api("/business/user/user").then((res) => {
					console.log(res);
					console.log(res.data.data);
					if (res.data.code == 1) {
						this.list = res.data.data
						this.num = res.data.data.personality_label.length
					}
				})
			},
			label(){
				uni.navigateTo({
					url:'../label/label'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.all {
		padding: 15px;

		.top {
			margin: 30px 0;

			.left {
				font-size: 14px;
				font-weight: bold;
				color: #333333;
			}

			.right {
				.img1 {
					width: 48px;
					height: 48px;
					border-radius: 50%;
				}

				.img2 {
					width: 15px;
					height: 15px;
				}
			}
		}

		.list {
			.box {
				padding: 10px 0;
				border-bottom: 1px solid #eeeeee;

				.left {
					font-size: 14px;
					font-weight: bold;
					color: #333333;
				}

				.right {
					font-size: 14px;
					font-weight: 400;
					color: #333333;

					.img1 {
						width: 16px;
						height: 16px;
					}
				}
			}
		}

		.allpop {
			padding: 15px 15px;

			.title {
				font-size: 17px;
				font-weight: bold;
				color: #333333;
				margin: 20px 0;
				text-align: center;
			}

			.body {
				padding: 5px 0;
				border-bottom: 1px solid #eeeeee;
				font-size: 14px;
				font-weight: 400;
				color: #333333;
				margin: 20px 0;

				input {
					font-size: 14px;
					font-weight: 400;
					color: #333333;
				}
			}

			.last {
				display: flex;
				align-items: center;

				.left {
					flex: 1;
					background: rgba(0, 0, 0, 0.05);
					border-radius: 40px;
					text-align: center;
					font-size: 14px;
					font-weight: bold;
					color: #999999;
					padding: 10px 0;
					margin: 0 5px;
				}

				.right {
					flex: 1;
					background: #FB774B;
					border-radius: 40px;
					text-align: center;
					font-size: 14px;
					font-weight: bold;
					color: #FFFFFF;
					padding: 10px 0;
					margin: 0 5px;
				}
			}
		}
	}
</style>